package com.guoliang.service.exceptionHandler;

import com.guoliang.commonUtils.CommonResult;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author ：Leo
 * @date ：Created in 2023/1/13 20:22
 * @description：
 */
@ControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(Exception.class)
    @ResponseBody
    public CommonResult error(Exception e){
      e.printStackTrace();
      return CommonResult.error().message("执行全局异常");
    }
}
